<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app"></div>
</body>
</html>
<script>
    var arr=[12,58,-23,56,12,-8,6,98,2,-15,7];
    var tmp={
        max:"",
        index:""
    }
    for(var i=0;i<arr.length-1;i++){
        var sum=arr[i]+arr[i+1];
        if(sum>tmp.max){
            tmp.max=sum;
            tmp.index=i;
        }
    }
    document.getElementById("app").innerHTML="最大和为:"+tmp.max+"|"+"相加的两个数为:"+arr[tmp.index]+"和"+arr[tmp.index+1];
</script>